package com.zx.dsptuneup_TriMic.network;

import com.zx.dsptuneup_TriMic.Data_Bean.DevicesDetailInfoBean;
import com.zx.dsptuneup_TriMic.Data_Bean.Strategy;
import com.zx.dsptuneup_TriMic.bean.BasicResponse;
import com.zx.dsptuneup_TriMic.bean.ChildDeviceBean;
import com.zx.dsptuneup_TriMic.bean.DeviceBean;
import com.zx.dsptuneup_TriMic.bean.LoginBean;
import com.zx.dsptuneup_TriMic.bean.TreeListBean;

import java.util.List;
import java.util.Map;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import io.reactivex.Observable;
import retrofit2.http.Query;

public interface NetWorkApi {
    // 通过userId登录，临时使用
    @POST("/manage/login")
    @FormUrlEncoded
    Observable<BasicResponse<LoginBean>> loginByUserName(@FieldMap Map<String, Object> map);
    // 退出登录
    @POST("/manage/loginOut")
    @FormUrlEncoded
    Observable<BasicResponse<String>> loginOutByUserName(@FieldMap Map<String, Object> map);
    // 树状列表
    @GET("/position/list")
    Observable<BasicResponse<List<TreeListBean>>> getTree();
    // 设备列表
    @POST("/device/list")
    @FormUrlEncoded
    Observable<BasicResponse<List<DeviceBean>>> getDevList(@FieldMap Map<String, Object> map);

    // 删除主设备 id用","分割
    @POST("/device/delList")
    Observable<BasicResponse<String>> delList(@Query("ids") String ids);
    // 根据group获取同一个group内的子设备
    @GET("/device/getChildByGroup")
    Observable<BasicResponse<List<DeviceBean>>> getDeviceChild(@Query("group") String groupId);

    // position操作 相关  添加位置
    @POST("/position/add")
    @FormUrlEncoded
    Observable<BasicResponse<String>> positionAdd(@FieldMap Map<String, Object> map);
    // 修改位置
    @POST("/position/mod")
    @FormUrlEncoded
    Observable<BasicResponse<String>> positionMod(@FieldMap Map<String, Object> map);
    // 删除位置
    @POST("/position/del")
    @FormUrlEncoded
    Observable<BasicResponse<String>> positionDel(@FieldMap Map<String, Object> map);
    // 修改/转移主设备
    @POST("/device/mod")
    @FormUrlEncoded
    Observable<BasicResponse<String>> deviceMod(@FieldMap Map<String, Object> map);


    //待添加的设备
    // 搜索主设备
    @GET("/device/search")
    Observable<BasicResponse<List<DeviceBean>>> getParentDevices();
    // 搜索子设备
    @GET("/device/searchChild")
    Observable<BasicResponse<List<ChildDeviceBean>>> getChildDevices();

    //添加主设备
    @POST("/device/add")
    @FormUrlEncoded
    Observable<BasicResponse<String>> addParrentDev(@FieldMap Map<String, Object> map);
    //批量添加主设备
    @POST("/device/addList")
    @FormUrlEncoded
    Observable<BasicResponse<String>> addParrentDevList(@FieldMap Map<String, Object> map);
    //子设备关联音频处理器
    @POST("/device/relation")
    @FormUrlEncoded
    Observable<BasicResponse<String>> getChildRelation(@FieldMap Map<String, Object> map);

    // 删除子设备
    @GET("/device/deleteChildDevice")
    Observable<BasicResponse<String>> deleteChildDevice(@Query("Id") String childId);

    // 查询指定设备
    @POST("/device/getById")
    @FormUrlEncoded
    Observable<BasicResponse<DevicesDetailInfoBean>> getDeviceInfoById(@FieldMap Map<String, Object> map);

    // 音量
    @POST("/device/volume")
    @FormUrlEncoded
    Observable<BasicResponse<String>> setVolume(@FieldMap Map<String, Object> map);
    // 静音
    @POST("/device/mute")
    @FormUrlEncoded
    Observable<BasicResponse<String>> setMute(@FieldMap Map<String, Object> map);
    // 远程
    @POST("/device/remote")
    @FormUrlEncoded
    Observable<BasicResponse<String>> setRemote(@FieldMap Map<String, Object> map);

    // 高低切
    @POST("/device/highLowCut")
    @FormUrlEncoded
    Observable<BasicResponse<String>> sethighLowCut(@FieldMap Map<String, Object> map);

    // EQ
    @POST("/device/EQ")
    @FormUrlEncoded
    Observable<BasicResponse<String>> setEQ(@FieldMap Map<String, Object> map);

    // matrix
    // http://localhost:8012/device/matrix?input=1&output=1&type=0&gain=45&group=1
    @POST("/device/matrix")
    @FormUrlEncoded
    Observable<BasicResponse<String>> setMatrix(@FieldMap Map<String, Object> map);

    @POST("/strategy/list")
    Observable<BasicResponse<List<Strategy>>> getStrategy();

    @POST("/strategy/start")
    @FormUrlEncoded
    Observable<BasicResponse<String>> startStrategy(@FieldMap Map<String, Object> map);

    // 替换主设备
    @GET("/device/replaceMainDevice")
    Observable<BasicResponse<String>> replaceMainDevice(@Query("oldId") String childId,@Query("mac") String mac);
    // 替换子设备
    @GET("/device/replaceChildDevice")
    Observable<BasicResponse<String>> replaceChildDevice(@Query("oldId") String childId,@Query("mac") String mac);

    // 转移子设备
    @GET("/device/transferDevice")
    Observable<BasicResponse<String>> transferChildDevice(@Query("childId") String childId,@Query("mainId") String mainId);

    // 恢复出厂设置
    @GET("/device/reset")
    Observable<BasicResponse<String>> resetDevice(@Query("ids") String ids);
    // 重启
    @GET("/device/restart")
    Observable<BasicResponse<String>> restartDevice(@Query("ids") String ids);

}
